home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Technical Docs / Misc Technical Docs / Installer 3.1Scripting Docs / EtherSniffer.a < prev    next >
Encoding:
Text File  |  1990-04-21  |  3.9 KB  |  113 lines  |  [TEXT/MPS ]

  1.     EJECT
  2. ;    LEGALESE:    © 1989, 1990 Apple Computer, Inc. All rights reserved.
  3. ;    
  4. ;    PROJECT:    System 7.0 Installer Script
  5. ;    
  6. ;    WHAT:        EtherSniffer - a routine which looks to see if an EtherTalk card is installed
  7. ;    
  8. ;    AUTHOR:        Bruce Jones
  9. ;    
  10. ;    PURPOSE:    This is an 'infn' code segment which can be called by the Installer to 
  11. ;                determine whether or not an Apple EtherTalk card is installed.  This code
  12. ;                resource will be included in an Installer script.
  13. ;
  14. ;    HISTORY:
  15. ;            4/21/90            BKJ            Clean up for Developer's Conference
  16. ;            11/17/89        BKJ            Dove Computer uses DrSwApple but is not compatible with our drivers.
  17. ;                                        This forces us to use the DrHw field of the type as well.  Sigh.
  18. ;            11/13/89        BKJ            Created 
  19. ;
  20. ;    BUILD:
  21. ;            asm "Bruce:MPW:Interfaces:AIncludes::astructmacs:"ProgStrucMacs.a -o Dev:Null
  22. ;            asm "Bruce:MPW:Interfaces:AIncludes::astructmacs:"FlowCtlMacs.a -o Dev:Null
  23. ;            asm EtherSniffer.a -o EtherSniffer.a.o
  24. ;            Link -ra =32 -rt infn=1001 -rn EtherSniffer.a.o -t rsrc -c RSED -o EtherSniffer.rsrc
  25. ;            Delete EtherSniffer.a.o
  26.  
  27.  
  28.         LOAD        'ProgStrucMacs.d'
  29.         LOAD        'FlowCtlMacs.d'
  30.         INCLUDE        'Traps.a'
  31.         INCLUDE        'SlotEqu.a'
  32.  
  33. ; a few symbols
  34. false            EQU            0
  35. true            EQU            1
  36. DEBUG            EQU            true                    ; 
  37.         
  38. ; Equates we need to supplement SlotEqu.a
  39. CatNetwork        EQU            $04                        ; Network category of devices
  40. TypEtherNet        EQU            $01                        ; within catNetwork, the type for EtherNet cards
  41. DrSwApple        EQU            $00                        ; The Apple Driver Interface
  42. DrHw3Com        EQU            $01                        ; The Apple Hardware
  43.  
  44.  
  45.  
  46. ; FUNCTION EtherSniffer(vRefNum: INTEGER; sysFolderDirID: LONGINT): BOOLEAN;
  47. ;
  48. ; This routine acts like a Pascal routine (may destroy D0-D2/A0-A1) and returns a boolean.
  49. ; We ignore the two parameters which are passed in.
  50. ; This routine uses the Slot Manager to determine if we have an EtherTalk card installed.
  51. ; We simply ask the Slot manager if a card with spCategory = catNetwork, spCType = typEtherNet
  52. ; and DrSWType = DrSwApple exists.   <11/17/89> We need to check DrHw field as well, see history.
  53. ;
  54.  
  55.  
  56. EXPORT    FUNCTION    EtherSniffer(vRefNum:W, sysFolderDirID:L):B
  57.  
  58.     VAR  slotMgrPB: SpBlock
  59.  
  60.     BEGIN
  61.         GOTO#.S        @Sniffer
  62.         ALIGN
  63.         DC.L        ('infn')                ; This looks good in the debugger & resedit!!
  64.         DC.W        0
  65.         DC.W        0
  66.         DC.B        'EtherSniffer (is an EtherTalk card installed?)'
  67.         ALIGN
  68.     
  69. @Sniffer
  70.         CLR.W        EtherSniffer(FP)                    ; Assume we'll return false
  71.     
  72.         ; Check to see if the slot manager exists - if it doesn't we can safely assume no card!
  73.         MOVE.W        #$A06E,d0                            ; Slot Manager trap number
  74.         _GetTrapAddress NEWOS
  75.         MOVE.W        a0,a1                                ; save this so we can compare it to unimplemented
  76.         
  77.         MOVE.W        #$A89F,d0                            ; Unimplemented trap number
  78.         _GetTrapAddress NEWOS
  79.         
  80.         GOTO#.S IF# a0 EQ.W a1 THEN @Done                ; If trap is not implemented then assume we can't have cards
  81.         
  82.     ;----------------------------------------
  83.         
  84.         ; We know the slot manager exists - ask it if the an ether card is installed
  85.         LEA            slotMgrPB(FP),a0                    ; point to param block
  86.         WITH        SpBlock
  87.             MOVE.B        #sFirstSlot,spSlot(a0)            ; start looking in the first slot
  88.             CLR.B        spID(a0)                        ; Just look at the Board sResource List
  89.             CLR.B        spExtDev(a0)                    ; we don't care about the device id
  90.             CLR.B        spTBMask(a0)                    ; Check all fields
  91.             MOVE.W        #catNetwork,spCategory(a0)        ; Looking for card whose category is network
  92.             MOVE.W        #typEtherNet,spCType(a0)        ; and whose type is EtherNet
  93.             MOVE.W        #drSwApple,spDrvrSW(a0)            ; and supports the Apple API
  94.             MOVE.W        #DrHw3Com,spDrvrHW(a0)            ; and it's Apple Hardware
  95.             CLR.B        spHWDev(a0)                        ; we don't care about any external devices
  96.         ENDWITH
  97.         _SNextTypesRsrc                                    ; Go look for the sResource -> the card
  98.         BNZ.S            @Done                            ; If we get an error back, assume no such card
  99.         
  100.     ;----------------------------------------
  101.             
  102. @CardFound                                                ; We know we have the card
  103.         ADDQ.B        #true,EtherSniffer(FP)                ; We had a default return of False, make it True
  104.     
  105.     ;----------------------------------------
  106.     
  107. @Done
  108.     
  109.     RETURN
  110.     ENDP
  111.     
  112.     
  113.     END